package org.dizem.groupon.dao.impl;

import org.dizem.groupon.dao.ImageDAO;
import org.dizem.groupon.model.domain.ImageEntity;
import org.hibernate.criterion.DetachedCriteria;

import java.util.List;

/**
 * User: dizem@126.com
 * Time: 11-6-26 下午11:39
 */
public class ImageDAOImpl extends DAOImplSupport<ImageEntity> implements ImageDAO {
	public ImageEntity getById(int id) {
		return (ImageEntity) getHibernateTemplate().get(ImageEntity.class, id);
	}

	public List<ImageEntity> loadAll() {
		return getHibernateTemplate().loadAll(ImageEntity.class);
	}

	public List<ImageEntity> load(int firstResult, int maxResult) {
		return getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(ImageEntity.class), firstResult, maxResult);
	}
}
